<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:72:"E:\workplace\project\Sunwm\web/../application/admin\view\index\home.html";i:1511501528;s:75:"E:\workplace\project\Sunwm\web/../application/admin\view\public\header.html";i:1503189484;s:73:"E:\workplace\project\Sunwm\web/../application/admin\view\public\city.html";i:1510310973;}*/ ?>
﻿<!DOCTYPE html>
<html lang="zh-cn">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title><?php echo config('sitename'); ?>-<?php echo lang('label')['Login_title']; ?></title>
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/public/css/pintuer.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/css/admin.css" />
		<script type="text/javascript" src="__ROOT__/static/public/js/jquery.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/js/pintuer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/admin/js/admin.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/layer/layer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laydate/laydate.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laytpl/laytpl.js"></script>
	</head>

	<body>
	<style>
		html { overflow-x:hidden; }
	</style>
<link rel="stylesheet" href="/web/static/admin/css/amazeui.min.css" />
<script src="/web/static/admin/js/amazeui.min.js"></script>
<script src="/web/static/public/js/echarts.js"></script>
<div style="margin-left:40px;margin-top: 20px">
	<script>
        //city 参数和回调
        var pid="<?php echo input('get.pid'); ?>";
        var cid="<?php echo input('get.cid'); ?>";
        var aid="<?php echo input('get.aid'); ?>";
        var selectc = true;
        var selecta = true;
        function select_p(){
            return false;
        }
        function select_c(){
            return false;
        }
        function select_a(){
            location.href="?pid="+pid+"&cid="+cid+"&aid="+aid;
        }
	</script>
	<?php echo lang('label')['select']; ?><?php echo lang('currency')['city']; ?>：<?php if(input('session.type') == 'province' || input('session.type') == 'all'): ?>
<select id="province" onchange="pchange(this.value)" name="pid" class="input input-auto" >
	<option value="">请选择</option>
</select>
<?php endif; if(input('session.type') == 'province' ||  input('session.type') == 'city' || input('session.type') == 'all'): ?>
<select id="city" onchange="cchange(this.value)" name="cid" class="input input-auto hidden" >
	<option value="">请选择</option>
</select>
<?php endif; ?>
<select id="area" onchange="achange(this.value)" name="aid" class="input input-auto hidden" >
	<option value="">请选择</option>
</select>
<script id="province_list_tpl" type="text/html">
	{{# for(var i = 0, len = d.data.length; i < len; i++){ }}
	<option {{# if(d.data[i].id==pid){ }}selected{{#}}} value="{{ d.data[i].id }}">{{ d.data[i].name }}</option>
	{{# } }}
</script>
<script id="city_list_tpl" type="text/html">
	{{# for(var i = 0, len = d.data.length; i < len; i++){ }}
	<option {{# if(d.data[i].id==cid){ }}selected{{#}}} value="{{ d.data[i].id }}">{{ d.data[i].name }}</option>
	{{# } }}
</script>
<script id="area_list_tpl" type="text/html">
	{{# for(var i = 0, len = d.data.length; i < len; i++){ }}
	<option {{# if(d.data[i].id==aid){ }}selected{{#}}} value="{{ d.data[i].id }}">{{ d.data[i].name }}</option>
	{{# } }}
</script>
<script>
    var func = false;
    $('select').click(function(){
        func = true;
    });
    if(selectc) {
        $('[name=cid]').removeClass('hidden');
    }
    if(selecta){
        $('[name=aid]').removeClass('hidden');
    }
    if('<?php echo input("session.type"); ?>' == 'province' || '<?php echo input("session.type"); ?>' == 'all') {
        $.getJSON('__ROOT__/admin/city/ajax_get?type=province', {}, function (res) {
            var tpl = $("#province_list_tpl").html();
            laytpl(tpl).render(res, function (render) {
                $("#province").html('<option value="">请选择</option>' + render);
            });
            if (pid != '' && pid != 0) {
                $('[name=pid]').change();
            }
        });
    }else if('<?php echo input("session.type"); ?>' == 'city'){
        val = '<?php echo input("session.aid"); ?>';
        if(selectc){
            $.getJSON('__ROOT__/admin/city/ajax_get?type=city&id='+val, {}, function(res){
                var tpl = $("#city_list_tpl").html();
                laytpl(tpl).render(res, function(render){
                    $("#city").html('<option value="">请选择</option>' + render);
                    $("#city").val(cid);
                    $("#city").change();
                });
            });
        }
    }else if('<?php echo input("session.type"); ?>' == 'area'){
        val = '<?php echo input("session.aid"); ?>';
        //if(selecta && aid){
            $.getJSON('__ROOT__/admin/city/ajax_get?type=area&nofather=ok&id='+val, {}, function(res){
                var tpl = $("#area_list_tpl").html();
                laytpl(tpl).render(res, function(render){
                    $("#area").html('<option value="">请选择</option>'+render);
                });
            });
       // }
    }
    function pchange(val) {
        pid = val;
        if(selectc){
            $.getJSON('__ROOT__/admin/city/ajax_get?type=city&id='+pid, {}, function(res){
                var tpl = $("#city_list_tpl").html();
                laytpl(tpl).render(res, function(render){
                    $("#city").html('<option value="">请选择</option>'+render);
                });
                if(selectc == true){
                    if(cid != '' && cid != 0){
                        $('[name=cid]').change();
                    }
                }
            });
        }
        if(func){
            select_p();
        }
    }
    function cchange(val) {
        cid = val;
        if(selecta && cid){
            $.getJSON('__ROOT__/admin/city/ajax_get?type=area&id='+cid, {}, function(res){
                var tpl = $("#area_list_tpl").html();
                laytpl(tpl).render(res, function(render){
                    $("#area").html('<option value="">请选择</option>'+render);
                });
            });
        }
        if(func){
            select_c();
        }
    }
    function achange(val) {
        aid = val;
        $('[name=aid]').removeClass('hidden');
        if(func){
            select_a();
        }
    }
</script>
	<?php if(input('get.aid')): ?>
		<div style="float: right;margin-right: 15px;color: red;">
			客服电话：<?php echo $service_phone; ?>
			<a href="javascript:edit()">更改</a>
		</div>
	<?php endif; ?>
</div>
<div class="row" style="width: 90%;margin-left: 20px;margin-top:20px;height: 100%">
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat blue">

			<div class="details">
				<!--<div class="number"> 2,985,465 </div>-->
				<div class="desc"> 总订单数量 </div>
				<div class="number"> <?php echo $data['sum_order_count']; ?> </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat red">

			<div class="details">
				<!--<div class="number"> 6533 </div>-->
				<div class="desc"> 今日订单量 </div>
				<div class="number"> <?php echo $data['today_order_count']; ?> </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat purple">
			<div class="details">
				<!--<div class="number"> 78699 </div>-->
				<div class="desc"> 配送员人数 </div>
				<div class="number"> <?php echo $data['express_total']; ?> </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
	<div class="dashboard-stat green">
		<div class="details">
			<!--<div class="number"> 78699 </div>-->
			<div class="desc"> 今日收益 </div>
			<div class="number"> <?php echo $data['money_total']; ?> </div>

		</div>

	</div>
</div>
</div>
<div id="rectangle" style="width: 45%;height:400px;float: left"></div>
<div id="circle" style="width: 45%;height: 400px;float: left"></div>
<script>
    var rectangle = echarts.init(document.getElementById("rectangle"));

    var date_string = '<?php echo $date_array; ?>';
    var date_array = date_string.split(',');

    var date_data = '<?php echo $date_data; ?>';
    var date_date_array = date_data.split(',');

    // 指定图表的配置项和数据
    option = {
        color: ['#27a9ff'],
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : date_array,
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'订单量',
                type:'bar',
                barWidth: '50%',
                data:date_date_array
            }
        ]
    };
    rectangle.setOption(option);


    var circle = echarts.init(document.getElementById("circle"));
    option = {
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series : [
            {
                name: '交易额',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    <?php echo $date_money_total_string; ?>
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    circle.setOption(option);


    layer.config({
        extend: 'extend/layer.ext.js'
    });
    function edit() {
        layer.prompt({title:'更改客服电话'},function(val){
            location.href="__URL__/home?service_phone="+val+"&pid=<?php echo input('get.pid'); ?>&cid=<?php echo input('get.cid'); ?>&aid="+aid;
        });
    }
</script>
